//package com.han.school.service.impl;
//
//import com.han.school.mapper.UserMapper;
//import com.han.school.pojo.User;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.security.crypto.password.PasswordEncoder;
//import org.springframework.stereotype.Service;
//
//@Service
//public class UserDetailsServiceImpl implements UserDetailsService {
//    @Autowired
//    private PasswordEncoder encoder;
//
//    @Autowired
//    private UserMapper userMapper;
//
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//        User user = userMapper.selectByName(username);
//        if (user==null){
//            throw new UsernameNotFoundException("请输入正确用户名");
//        }
//        return new User(user.getUname(), user.getPwd());
//    }
//}
